<?xml version="1.0" encoding="utf-8"?>
<!--
                                                                                     
 h       t     t                ::       /     /                     t             / 
 h       t     t                ::      //    //                     t            // 
 h     ttttt ttttt ppppp sssss         //    //  y   y       sssss ttttt         //  
 hhhh    t     t   p   p s            //    //   y   y       s       t          //   
 h  hh   t     t   ppppp sssss       //    //    yyyyy       sssss   t         //    
 h   h   t     t   p         s  ::   /     /         y  ..       s   t    ..   /     
 h   h   t     t   p     sssss  ::   /     /     yyyyy  ..   sssss   t    ..   /     
                                                                                     
	<https://y.st./>
	Copyright © 2017 Alex Yst <mailto:copyright@y.st>

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program. If not, see <https://www.gnu.org./licenses/>.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<base href="https://y.st./en/weblog/2017/08-August/25.xhtml" />
		<title>Compromises in code &lt;https://y.st./en/weblog/2017/08-August/25.xhtml&gt;</title>
		<link rel="icon" type="image/png" href="/link/CC_BY-SA_4.0/y.st./icon.png" />
		<link rel="stylesheet" type="text/css" href="/link/basic.css" />
		<link rel="stylesheet" type="text/css" href="/link/site-specific.css" />
		<script type="text/javascript" src="/script/javascript.js" />
		<meta name="viewport" content="width=device-width" />
	</head>
	<body>
		<nav>
			<p>
				<a href="/en/">Home</a> |
				<a href="/en/a/about.xhtml">About</a> |
				<a href="/en/a/contact.xhtml">Contact</a> |
				<a href="/a/canary.txt">Canary</a> |
				<a href="/en/URI_research/"><abbr title="Uniform Resource Identifier">URI</abbr> research</a> |
				<a href="/en/opinion/">Opinions</a> |
				<a href="/en/coursework/">Coursework</a> |
				<a href="/en/law/">Law</a> |
				<a href="/en/a/links.xhtml">Links</a> |
				<a href="/en/weblog/2017/08-August/25.xhtml.asc">{this page}.asc</a>
			</p>
			<hr/>
			<p>
				Weblog index:
				<a href="/en/weblog/"><abbr title="American Standard Code for Information Interchange">ASCII</abbr> calendars</a> |
				<a href="/en/weblog/index_ol_ascending.xhtml">Ascending list</a> |
				<a href="/en/weblog/index_ol_descending.xhtml">Descending list</a>
			</p>
			<hr/>
			<p>
				Jump to entry:
				<a href="/en/weblog/2015/03-March/07.xhtml">&lt;&lt;First</a>
				<a rel="prev" href="/en/weblog/2017/08-August/24.xhtml">&lt;Previous</a>
				<a rel="next" href="/en/weblog/2017/08-August/26.xhtml">Next&gt;</a>
				<a href="/en/weblog/latest.xhtml">Latest&gt;&gt;</a>
			</p>
			<hr/>
		</nav>
		<header>
			<h1>Compromises in code</h1>
			<p>Day 00902: Friday, 2017 August 25</p>
		</header>
<section id="general">
	<h2>General news</h2>
	<p>
		As I was heading out the door to go to work, I was rummaging through some stuff and found a certificate from the <abbr title="human immunodeficiency virus">HIV</abbr> Alliance.
		It offers a gift card to people identifying as men that have sex with men if they take a gratis <abbr title="human immunodeficiency virus">HIV</abbr> test at their Eugene office.
		I was thinking it&apos;d be easy money.
		It wouldn&apos;t be worth the time and energy to bike out there for it, but it&apos;d be a nice excuse for some exercise as long as I admit the money&apos;s not the main reason for going.
		But then I realised that I don&apos;t qualify.
		I don&apos;t identify as a man, but even changing that to males that have sex with males ... I&apos;m a virgin.
		I&apos;m hella gay, but I don&apos;t have sex with <strong>*anyone*</strong> yet.
		It strikes me as peculiar that I&apos;m a gay male, but I&apos;m not a male that has sex with males.
		It makes perfect sense, but it still feels almost paradoxical.
	</p>
	<p>
		My <a href="/a/canary.txt">canary</a> still sings the tune of freedom and transparency.
	</p>
</section>
<section id="include.d">
	<h2><a href="https://git.volatile.ch./y.st./include.d/releases">include.d</a></h2>
	<p>
		I hit a bit of an issue while trying to set up the type-hinting for my code.
		When functions and methods are not supposed to return a value, this can&apos;t be enforced.
		I&apos;m going to need to rewrite my functions and methods to always return a value of some sort.
		If there&apos;s no possible helpful value to return, I guess I&apos;ll return a constant boolean or something.
		A bit after finding this limitation, I found that it was actually fixed in a later version of <abbr title="PHP: Hypertext Preprocessor">PHP</abbr>.
		That&apos;ll definitely help with future code, but it won&apos;t help now.
		I develop for the version of <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> that ships with Debian Stable for greatest compatibility.
		I can&apos;t make use of this fix just yet, and by the time I can, my rewrite should be long past complete.
	</p>
	<p>
		A few methods in one of my wrapper classes can&apos;t be fully updated to make use of the type hinting, and won&apos;t be able to even with the later update.
		One takes a value as a parameter that can be either a string or an integer.
		Another returns a value that can be a string, an integer, or a boolean.
		I could break these methods into multiple methods, but I&apos;m reluctant to do that.
		The class is just supposed to act as a thin wrapper, binding a resource handle to the functions that operate on it.
		A third method requires an object as an argument, but that object may be of any class.
		I can&apos;t type hint for general objects.
		Similar issues were present in my other wrapper class as well.
		I think I&apos;ll just leave the new feature use out here.
		I fully intend to update all my non-wrapper classes to conform to the strict type-hinting though.
	</p>
	<p>
		That is, at least when not implementing built-in interfaces or providing callbacks for built-in functions.
		It seems that when implementing an interface that doesn&apos;t make use of type-hinting, parameters can&apos;t be type-hinted.
		I don&apos;t have a way around that.
		Also, some callback functions need to accept a resource handle as an argument.
		That can&apos;t be type-hinted for either.
	</p>
	<p>
		I&apos;ve finished up pretty much all the update, with the exception of the <abbr title="Uniform Resource Identifier">URI</abbr>-handling code.
		That code&apos;s a bit complex, and, as I said before, the documentation on it&apos;s out of date.
		I thought I&apos;d finished up the code of the main abstract class, but then I got to the main class that descends from it.
		The main issue there is that the return value types have been changed in several key methods.
		I&apos;ll need to finish updating this class, then go back and fix up the abstract class to allow the child class to even descend from it.
		Then there&apos;s the fact that I can&apos;t enforce null return values, so I need to alter the code to provide reasonable return values where possible.
		Several methods operated on arrays without copying them, but to provide decent return values, that&apos;ll need to change.
		Passes by reference will need to be removed, and code that called those methods restructured.
		It&apos;ll take some time, that&apos;s for sure.
		And once it&apos;s all complete, I&apos;ll need to go through the documentation and finish updating it.
	</p>
</section>
		<hr/>
		<p>
			Copyright © 2017 Alex Yst;
			You may modify and/or redistribute this document under the terms of the <a rel="license" href="/license/gpl-3.0-standalone.xhtml"><abbr title="GNU&apos;s Not Unix">GNU</abbr> <abbr title="General Public License version Three or later">GPLv3+</abbr></a>.
			If for some reason you would prefer to modify and/or distribute this document under other free copyleft terms, please ask me via email.
			My address is in the source comments near the top of this document.
			This license also applies to embedded content such as images.
			For more information on that, see <a href="/en/a/licensing.xhtml">licensing</a>.
		</p>
		<p>
			<abbr title="World Wide Web Consortium">W3C</abbr> standards are important.
			This document conforms to the <a href="https://validator.w3.org./nu/?doc=https%3A%2F%2Fy.st.%2Fen%2Fweblog%2F2017%2F08-August%2F25.xhtml"><abbr title="Extensible Hypertext Markup Language">XHTML</abbr> 5.1</a> specification and uses style sheets that conform to the <a href="http://jigsaw.w3.org./css-validator/validator?uri=https%3A%2F%2Fy.st.%2Fen%2Fweblog%2F2017%2F08-August%2F25.xhtml"><abbr title="Cascading Style Sheets">CSS</abbr>3</a> specification.
		</p>
	</body>
</html>

